//#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int dfn[200005] = { 0 }, low[200005] = { 0 }, timestamps = 0;
vector<int>vec[200005];
set<int>ans;
int root;

void tarjan(int u) {
	dfn[u] = low[u] = ++timestamps;
	int children = 0;
	for (int v : vec[u]) {
		if (!dfn[v]) {
			children++;
			tarjan(v);
			low[u] = min(low[u], low[v]);
			if (low[v] >= dfn[u] && u != root)
				ans.insert(u);
		}
		else {
			low[u] = min(low[u], dfn[v]);
		}
	}
	if (children > 1 && u == root)
		ans.insert(u);
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m;
	cin >> n >> m;

	for (int i = 1;i <= m;i++) {
		int u, v;
		cin >> u >> v;
		vec[u].push_back(v);
		vec[v].push_back(u);
	}
	for (int i = 1;i <= n;i++) {
		if (!dfn[i]) {
			root = i;
			tarjan(i);
		}
	}
	cout << ans.size() << endl;
	for (const auto at : ans) {
		cout << at << " ";
	}
	return 0;
}